/**
 * 程序主类
 * 包含main方法，作为程序的入口点
 */
public class Main {
    public static void main(String[] args) {
        System.out.println("===== 学生选课模拟系统 =====");
        
        // 创建课程（按编号、课程名称、上课地点的顺序初始化）
        Course math = new Course("C001", "高等数学", "一号教学楼101", "周一、周三 10:00-12:00", 3);
        Course physics = new Course("C002", "大学物理", "二号教学楼202", "周二、周四 14:00-16:00", 2);
        Course java = new Course("C003", "Java程序设计", "计算机楼303", "周一至周五 08:00-09:40", 4);
        
        // 创建教师
        Teacher teacher1 = new Teacher("T001", "张教授", "男");
        Teacher teacher2 = new Teacher("T002", "李老师", "女");
        Teacher teacher3 = new Teacher("T003", "王讲师", "男");
        
        // 教师授课
        System.out.println("\n----- 教师授课 -----");
        teacher1.teachCourse(math);
        teacher2.teachCourse(physics);
        teacher3.teachCourse(java);
        
        // 打印教师信息及所授课程
        System.out.println("\n----- 打印教师信息及所授课程 -----");
        teacher1.printTaughtCourses();
        teacher2.printTaughtCourses();
        teacher3.printTaughtCourses();
        
        // 创建学生
        Student student1 = new Student("S001", "张三", "男");
        Student student2 = new Student("S002", "李四", "女");
        Student student3 = new Student("S003", "王五", "男");
        Student student4 = new Student("S004", "赵六", "女");
        
        // 学生选课
        System.out.println("\n----- 学生选课 -----");
        student1.selectCourse(math);
        student1.selectCourse(java);
        student2.selectCourse(math);
        student2.selectCourse(physics);
        student3.selectCourse(physics);
        student3.selectCourse(java);
        student4.selectCourse(math);  // 这是第4个选数学的学生，会失败
        student4.selectCourse(java);
        
        // 学生退课
        System.out.println("\n----- 学生退课 -----");
        student2.dropCourse(math);
        student4.selectCourse(math);  // 现在数学有空位了
        
        // 打印学生课表
        System.out.println("\n----- 打印学生课表 -----");
        student1.printCourseSchedule();
        student2.printCourseSchedule();
        student3.printCourseSchedule();
        student4.printCourseSchedule();
        
        System.out.println("\n===== 系统运行结束 =====");
    }
}
